
const boxEl = document.getElementById('box');
const btnEl = document.getElementById('btn');

btnEl.addEventListener('click', () => {
  randomItem();
});

function randomItem() {
  let styleArr = [0,0,0,0,1,1,2,3];
  styleArr = styleArr.sort(() => {
    return Math.random() > 0.5 ? 1 : -1;   
  });
  let itemsEl = '';
  for (let i = 0; i < styleArr.length; i++) {
    itemsEl += `<div class="grid-box-item-${styleArr[i]}">${i}</div>`;
  }

  boxEl.innerHTML = itemsEl;
}

randomItem();
